#!/usr/bin/python
# -*- coding: utf-8 -*-

import brush
import pyglet

class Window(pyglet.window.Window):
	def __init__(self):
		config = pyglet.gl.Config(buffer_size=32, alpha_size=8,
			sample_buffers=1, samples=4)
		super(Window, self).__init__(config=config)
		
		self.objs = [
			brush.Triangle(((50, 50), (200, 100), (150, 200)),
				(255, 0, 0), True),
			brush.Rectangle((150, 150, 300, 200), (255, 255, 0, 200), True),
			brush.Circle((500, 400), 40, (0, 0, 255, 250), True),
			brush.Polygon(((100, 400), (200, 380), (300, 400), (150, 300), (50, 450)), strip=True),
			brush.Point((5, 5))
		]
	
	def on_key_release(symbol, modifiers):
		if symbol == pyglet.key.ESCAPE:
			pyglet.app.exit()
	
	def on_draw(self):
		brush.clear((0, 0, 0))
		brush.set_impo()
		
		for obj in self.objs:
			obj.draw()


if __name__ == '__main__':
	Window()
	pyglet.app.run()